# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=rime-stroke
pkgver=0.0.0.20230204
_commit=c8bc4050d4d667be8f3f4892ab96e4d0881865a4
pkgrel=1
pkgdesc="Stroke input for rime"
arch=('loong64' 'x86_64')
url="https://github.com/rime/rime-stroke"
license=('LGPL')
# dependency for reverse lookup
depends=('rime-luna-pinyin')
makedepends=('git' 'librime' 'rime-prelude' 'rime-essay')
source=("git+https://github.com/rime/rime-stroke.git#commit=$_commit")
sha512sums=('SKIP')

prepare() {
  cd $pkgname
  # Link essentials
  for _f in $(pacman -Qql rime-prelude rime-essay | grep -v "/$"); do ln -sf $_f; done
}

build(){
  cd $pkgname
  for _s in $(ls *.schema.yaml); do rime_deployer --compile $_s; done
}

package() {
  cd $pkgname
  find . -type l -delete
  rm build/*.txt
  install -Dm644 *.yaml -t "$pkgdir"/usr/share/rime-data/
  install -Dm644 build/* -t "$pkgdir"/usr/share/rime-data/build/
}
